// ----------------------------------
// RSDK Project: Sonic 2
// Script Description: Menu Control Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

// ========================
// Aliases
// ========================

private alias object.value0 : object.timer
private alias object.value1 : object.scrollDelayUp
private alias object.value2 : object.scrollDelayDown
private alias object.value3 : object.currentSelection
private alias object.value4 : object.soundTestCooldown

// HexNo Aliases
private alias object.value0 : hexNo.number
private alias object.value1 : hexNo.highlighted

private alias 0  : HEXNO_HIGHLIGHT_FALSE
private alias 16 : HEXNO_HIGHLIGHT_TRUE

private alias 0 : MENUCONTROL_INIT
private alias 1 : MENUCONTROL_FADEIN
private alias 2 : MENUCONTROL_MAIN
private alias 3 : MENUCONTROL_LOADLEVEL
private alias 4 : MENUCONTROL_LOADSPECIAL

// The maximum number of selections available
// (Inclusive limit)
private alias 38 : MAX_SELECTION_COUNT

// Music Loops
private alias 152750 : MUSIC_LOOP_EHZ_1P
private alias 18671  : MUSIC_LOOP_MCZ_2P // This is 18672 in some other cases...
private alias 293572 : MUSIC_LOOP_OOZ
private alias 309378 : MUSIC_LOOP_MPZ
private alias 1      : MUSIC_LOOP_HTZ
private alias 1      : MUSIC_LOOP_ARZ
private alias 95868  : MUSIC_LOOP_CNZ_2P
private alias 62820  : MUSIC_LOOP_CNZ_1P
private alias 1      : MUSIC_LOOP_DEZ
private alias 99356  : MUSIC_LOOP_MCZ_1P
private alias 99572  : MUSIC_LOOP_EHZ_2P
private alias 198253 : MUSIC_LOOP_SCZ
private alias 684580 : MUSIC_LOOP_CPZ
private alias 99874  : MUSIC_LOOP_WFZ
private alias 59852  : MUSIC_LOOP_PPZ
private alias 496644 : MUSIC_LOOP_SPECIAL
private alias 38679  : MUSIC_LOOP_INV

// Music Event Aliases
private alias 2 : MUSICEVENT_TRANSITION


// ========================
// Function Declarations
// ========================

reserve function MenuControl_HandleSecrets
reserve function MenuControl_SoundTestPlayer


// ========================
// Static Values
// ========================

public value MenuControl_optionsMenuOpen		= 0
private value MenuControl_optionsMenuCounter 	= 0
private value MenuControl_debugModeCounter 		= 0
private value MenuControl_emeraldCodeCounter 	= 0
private value MenuControl_continueCodeCounter 	= 0
private value MenuControl_PPZCodeCounter 		= 0


// ========================
// Tables
// ========================

// Code to open the game config menu
private table MenuControl_OptionsMenu
	0, 0, 0
end table

// Code to enable debug mode
private table MenuControl_SecretDebugMode
	1, 9, 9, 2, 1, 1, 2, 4
end table

// Code to give all emeralds
private table MenuControl_SecretEmeralds
	4, 1, 2, 6
end table

// Code to give 14 continues
private table MenuControl_SecretContinues
	1, 1, 2, 4
end table

// Code to replace Hidden Palace Zone with Proto Palace Zone
private table MenuControl_SecretPPZ
	0
end table


// This table holds data for every stage with six values for every stage,
// -> First entry is menu table the stage option is on
// -> Second is what number this one is on the list, from top to bottom
// -> Third is the active stage list the stage is on
// -> Fourth is the stage's position in the stage list
// -> Fifth is the menu entry of what is on the opposite side of this selection, like how MTZ is to the right of EHZ and vice versa
// -> Sixth is the icon the entry uses

private table MenuControl_EntryTable
	0, 0,  1,  0, 19,  1	//  0 - Green Hill   Stage 0
	0, 1,  1,  1, 20,  1	//  1 - Green Hill   Stage 1
	0, 2,  1,  2, 21,  2	//  2 - Ocean Wind   Stage 0
	0, 3,  1,  3, 22,  2	//  3 - Ocean Wind   Stage 1
	0, 4,  1,  4, 23,  3	//  4 - Woods        Stage 0
	0, 5,  1,  5, 24,  3	//  5 - Woods        Stage 1
	0, 6,  1,  6, 25,  4	//  6 - Sand Shower  Stage 0
	0, 7,  1,  7, 26,  4	//  7 - Sand Shower  Stage 1
	0, 8,  1,  8, 27,  5	//  8 - Metropolis   Stage 0
	0, 9,  1,  9, 28,  5	//  9 - Metropolis   Stage 1
	0, 10, 1, 10, 29,  6	// 10 - Warp Point   Stage 0
	0, 11, 1, 11, 30,  7	// 11 - Tropical Summer Stage 0
	0, 12, 1, 12, 31,  7	// 12 - Tropical Summer Stage 1
	0, 13, 1, 13, 32,  8	// 13 - Blue Lake    Stage 0
	0, 14, 1, 14, 33,  8	// 14 - Blue Lake    Stage 1
	0, 15, 1, 15, 34,  9	// 15 - Hill Top     Stage 0
	0, 16, 1, 16, 35,  9	// 16 - Hill Top     Stage 1
	0, 17, 1, 17, 36, 10	// 17 - Rock World   Stage 0
	0, 18, 1, 18, 37, 10	// 18 - Rock World   Stage 1
	1, 0,  1, 19,  0, 11	// 19 - Oil Ocean    Stage 0
	1, 1,  1, 20,  1, 11	// 20 - Oil Ocean    Stage 1
	1, 2,  1, 21,  2, 12	// 21 - Dust Hill    Stage 0
	1, 3,  1, 22,  3, 12	// 22 - Dust Hill    Stage 1
	1, 4,  1, 23,  4, 13	// 23 - Death Egg    Stage 0
	1, 5,  1, 24,  5, 14	// 24 - Blue Lake    Stage 0
	1, 6,  1, 25,  6, 14	// 25 - Blue Lake    Stage 1
	1, 7,  1, 26,  7, 15	// 26 - Hill Top     Stage 0
	1, 8,  1, 27,  8, 15	// 27 - Hill Top     Stage 1
	1, 9,  1, 28,  9, 16	// 28 - Casino Night Stage 0
	1, 10, 1, 29, 10, 16	// 29 - Casino Night Stage 1
	1, 11, 1, 30, 11, 17	// 30 - Chemical Factory Stage 0
	1, 12, 1, 31, 12, 17	// 31 - Chemical Factory Stage 1
	1, 13, 1, 32, 13, 18	// 32 - Genocide City Stage 0
	1, 14, 1, 33, 14, 18	// 33 - Genocide City Stage 1
	1, 15, 1, 34, 15, 18	// 34 - Genocide City Stage 2
	1, 16, 1, 35, 16, 19	// 35 - Neo Death Egg Stage 0
	1, 17, 1, 36, 17, 19	// 36 - Neo Death Egg Stage 1
	1, 18, 2,  0, 18, 13	// 37 - Special Stage
	1, 19, 0,  0, 67,  0 	// 38 - Sound Test
end table


// ========================
// Function Defintions
// ========================

private function MenuControl_HandleSecrets
	// Set the Special Stage act number, for acts 1-8
	if hexNo[+1].number < 8
		SetTableValue(hexNo[+1].number, 129, MenuControl_EntryTable)
	end if

	// Handle the options menu check
	GetTableValue(temp0, MenuControl_optionsMenuCounter, MenuControl_OptionsMenu)

	if temp0 == hexNo[+1].number
		MenuControl_optionsMenuCounter++
		if MenuControl_optionsMenuCounter == 3
			MenuControl_optionsMenuCounter = 0
	
			CreateTempObject(TypeName[Config Screen], 0, 0, 0)
			MenuControl_optionsMenuOpen = true
	
			PlaySfx(SfxName[Resume], false)
		end if
	else
		MenuControl_optionsMenuCounter = 0
	end if
	
	// Handle the debug mode code
	GetTableValue(temp0, MenuControl_debugModeCounter, MenuControl_SecretDebugMode)

	if temp0 == hexNo[+1].number
		MenuControl_debugModeCounter++
		if MenuControl_debugModeCounter == 8
			MenuControl_debugModeCounter = 0

			stage.debugMode = true

			PlaySfx(SfxName[Ring L], false)
		end if
	else
		MenuControl_debugModeCounter = 0
	end if

	// Handles the code for all emeralds
	GetTableValue(temp0, MenuControl_emeraldCodeCounter, MenuControl_SecretEmeralds)

	if temp0 == hexNo[+1].number
		MenuControl_emeraldCodeCounter++
		if MenuControl_emeraldCodeCounter == 4
			MenuControl_emeraldCodeCounter = 0

			// Give the player all 7 emeralds
			specialStage.emeralds = 0x7F
#platform: USE_ORIGINS
			game.cheatEmeralds = true
#endplatform
			PlaySfx(SfxName[Emerald], false)
			StopMusic()
		end if
	else
		MenuControl_emeraldCodeCounter = 0
	end if

	if MenuControl_debugModeCounter < 2
		GetTableValue(temp0, MenuControl_continueCodeCounter, MenuControl_SecretContinues)
		if temp0 == hexNo[+1].number
			MenuControl_continueCodeCounter++
			if MenuControl_continueCodeCounter == 4
				MenuControl_continueCodeCounter = 0

				player.continues = 14
				PlaySfx(SfxName[Continue], false)
			end if
		else
			MenuControl_continueCodeCounter = 0
		end if
	else
		MenuControl_continueCodeCounter = 0
	end if
	
#platform: USE_ORIGINS
	// In place of unlocking PPZ, Origins added in some cool debug stuff instead
	CallNativeFunction4(NotifyCallback, NOTIFY_DEBUGPRINT, stage.debugMode, MenuControl_PPZCodeCounter, hexNo[+1].number)
#endplatform

	if stage.debugMode == true
		GetTableValue(temp0, MenuControl_PPZCodeCounter, MenuControl_SecretPPZ)
		if temp0 == hexNo[+1].number
			MenuControl_PPZCodeCounter++
			if MenuControl_PPZCodeCounter == 8
				MenuControl_PPZCodeCounter = 0

#platform: USE_STANDALONE
				// Change the Hidden Palace slot to use Proto P, 122, MenuControl_EntryTable)
				SetTableValue(11, 123, MenuControl_EntryTable)
#endplatform

				PlaySfx(SfxName[Ring L], false)

				// Set the Hidden Palace unlock flag to true
				saveRAM[46] = true
			end if
		else
			MenuControl_PPZCodeCounter = 0
		end if
	end if
end function


private function MenuControl_SoundTestPlayer
	// Don't play songs in quick succession
	if object.soundTestCooldown == 0
		object.soundTestCooldown = 30

		switch hexNo[+1].number
		case 0
			break

		case 1
			SetMusicTrack("Results.ogg", 0, true)
			PlayMusic(0)
			break

		case 2
			SetMusicTrack("EmeraldHill.ogg", 0, MUSIC_LOOP_EHZ_1P)
			PlayMusic(0)
			break

		case 3
			SetMusicTrack("MysticCave2.ogg", 0, MUSIC_LOOP_MCZ_2P)
			PlayMusic(0)
			break

		case 4
			SetMusicTrack("OilOcean.ogg", 0, MUSIC_LOOP_OOZ)
			PlayMusic(0)
			break

		case 5
			SetMusicTrack("Metropolis.ogg", 0, MUSIC_LOOP_MPZ)
			PlayMusic(0)
			break

		case 6
			SetMusicTrack("HillTop.ogg", 0, MUSIC_LOOP_HTZ)
			PlayMusic(0)
			break

		case 7
			SetMusicTrack("AquaticRuin.ogg", 0, MUSIC_LOOP_ARZ)
			PlayMusic(0)
			break

		case 8
			SetMusicTrack("CasinoNight2.ogg", 0, MUSIC_LOOP_CNZ_2P)
			PlayMusic(0)
			break

		case 9
			SetMusicTrack("CasinoNight.ogg", 0, MUSIC_LOOP_CNZ_1P)
			PlayMusic(0)
			break

		case 10
			SetMusicTrack("DeathEgg.ogg", 0, MUSIC_LOOP_DEZ)
			PlayMusic(0)
			break

		case 11
			SetMusicTrack("MysticCave.ogg", 0, MUSIC_LOOP_MCZ_1P)
			PlayMusic(0)
			break

		case 12
			SetMusicTrack("EmeraldHill2.ogg", 0, MUSIC_LOOP_EHZ_2P)
			PlayMusic(0)
			break

		case 13
			SetMusicTrack("SkyChase.ogg", 0, MUSIC_LOOP_SCZ)
			PlayMusic(0)
			break

		case 14
			SetMusicTrack("ChemicalPlant.ogg", 0, MUSIC_LOOP_CPZ)
			PlayMusic(0)
			break

		case 15
			SetMusicTrack("WingFortress.ogg", 0, MUSIC_LOOP_WFZ)
			PlayMusic(0)
			break

		case 16
			SetMusicTrack("Extra.ogg", 0, MUSIC_LOOP_PPZ)
			PlayMusic(0)
			break

		case 17
			SetMusicTrack("Options.ogg", 0, true)
			PlayMusic(0)
			break

		case 18
			SetMusicTrack("SpecialStage.ogg", 0, MUSIC_LOOP_SPECIAL)
			PlayMusic(0)
			break

		case 19
			SetMusicTrack("Boss.ogg", 0, true)
			PlayMusic(0)
			break

		case 20
			SetMusicTrack("FinalBoss.ogg", 0, true)
			PlayMusic(0)
			break

		case 21
			SetMusicTrack("Ending.ogg", 0, false)
			PlayMusic(0)
			break

		case 22
			SetMusicTrack("Super.ogg", 0, true)
			PlayMusic(0)
			break

		case 23
			SetMusicTrack("Invincibility.ogg", 0, MUSIC_LOOP_INV)
			PlayMusic(0)
			break

		case 24
			PlaySfx(SfxName[Life], false)
			PauseMusic()
			ResetObjectEntity(26, TypeName[Music Event], MUSICEVENT_TRANSITION, 0, 0)
			object[26].priority = PRIORITY_ACTIVE
			break

		case 25
			SetMusicTrack("TitleScreen.ogg", 0, false)
			PlayMusic(0)
			break

		case 26
			SetMusicTrack("ActComplete.ogg", 0, false)
			PlayMusic(0)
			break

		case 27
			SetMusicTrack("GameOver.ogg", 0, false)
			PlayMusic(0)
			break

		case 28
			SetMusicTrack("Continue.ogg", 0, false)
			PlayMusic(0)
			break

		case 29
			StopMusic()
			PlaySfx(SfxName[Emerald], false)
			break

		case 30
			SetMusicTrack("Credits.ogg", 0, false)
			PlayMusic(0)
			break

		case 31
			SetMusicTrack("Drowning.ogg", 0, false)
			PlayMusic(0)
			break
		end switch
	end if
end function


// ========================
// Events
// ========================

event ObjectUpdate
	// Setup the HexNo object
	object[+1].xpos = screen.xcenter
	object[+1].xpos += 120

	switch object.state
	case MENUCONTROL_INIT
		object.timer = 320
		SetScreenFade(0, 0, 0, object.timer)
		object[+1].ypos = 160
		object[+1].priority = PRIORITY_ACTIVE
		object.state++
		break

	case MENUCONTROL_FADEIN
		if object.timer > 0
			object.timer -= 16
		else
			PlayMusic(0)
			object.state++
		end if
		SetScreenFade(0, 0, 0, object.timer)
		break

	case MENUCONTROL_MAIN
		// Don't do any of this if the options menu is open
		if MenuControl_optionsMenuOpen == false
			if keyDown[0].down == true
				object.scrollDelayUp = 0
				object.scrollDelayDown++
				if object.scrollDelayDown == 1
					object.currentSelection++
				end if

				object.scrollDelayDown %= 12
			else
				if keyDown[0].up == true
					object.scrollDelayDown = 0
					object.scrollDelayUp++
					if object.scrollDelayUp == 1
						object.currentSelection--
					end if

					object.scrollDelayUp %= 12
				else
					object.scrollDelayUp = 0
					object.scrollDelayDown = 0
				end if
			end if

			if object.currentSelection > MAX_SELECTION_COUNT
				object.currentSelection = 0
			end if

			if object.currentSelection < 0
				object.currentSelection = MAX_SELECTION_COUNT
			end if

			temp0 = object.currentSelection
			temp0 *= 6
			temp0++
			GetTableValue(temp2, temp0, MenuControl_EntryTable)
			temp0 += 3
			GetTableValue(temp1, temp0, MenuControl_EntryTable)

			switch temp1
			default
				checkResult = keyPress[0].left
				checkResult |= keyPress[0].right

				if checkResult == true
					object.currentSelection = temp1
				end if

				hexNo[+1].highlighted = HEXNO_HIGHLIGHT_FALSE

				if keyPress[0].buttonA == true
					keyPress[0].start = true
				end if
				break

			case 67 // Sound test
				if object.soundTestCooldown > 0
					object.soundTestCooldown--
				end if

				hexNo[+1].highlighted = HEXNO_HIGHLIGHT_TRUE

				if keyPress[0].buttonA == true
					hexNo[+1].number += 16
				end if
				
				if keyPress[0].left == true
					hexNo[+1].number--
				end if
				
				if keyPress[0].right == true
					hexNo[+1].number++
				end if

				// Limit the number's maximum count
				hexNo[+1].number &= 31

				if keyPress[0].buttonB == true
					CallFunction(MenuControl_SoundTestPlayer)
					CallFunction(MenuControl_HandleSecrets)
				end if
				if keyPress[0].buttonC == true
					CallFunction(MenuControl_SoundTestPlayer)
					CallFunction(MenuControl_HandleSecrets)
				end if
				break
			end switch

			temp0 = object.currentSelection
			temp0 *= 6
			GetTableValue(temp1, temp0, MenuControl_EntryTable)
			temp0++

			if temp1 == MENU_1
				menu2.selection = -1
				GetTableValue(menu1.selection, temp0, MenuControl_EntryTable)
			else // MENU_2
				menu1.selection = -1
				GetTableValue(menu2.selection, temp0, MenuControl_EntryTable)
			end if

			// Set the preview image to what it should be
			temp0 += 4
			GetTableValue(BGAnimation_currentPreview, temp0, MenuControl_EntryTable)

			// Player selected the option?
			if keyPress[0].start == true

				// Special Stage
				if object.currentSelection == 21
					PlaySfx(SfxName[Warp], false)
					object.state = MENUCONTROL_LOADSPECIAL
					fadeColor = 208
					fadeColor <<= 16
					temp0 = 255
					temp0 <<= 8
					fadeColor += temp0
					fadeColor += 224
				else
					// Hidden Palace?
					if object.currentSelection == 99
						// See if the player has it unlocked
						if saveRAM[46] == true
							// Proceed and load the level like normal
							object.state = MENUCONTROL_LOADLEVEL
						else
							// Haven't played it legitimately yet, sorry...
							PlaySfx(SfxName[Fail], false)
						end if
					else
						// Normal stage - let the player proceed
						object.state = MENUCONTROL_LOADLEVEL
					end if
				end if
			end if
		end if
		break

	case MENUCONTROL_LOADLEVEL
		if object.timer < 256
			music.volume -= 10
			object.timer += 16
			SetScreenFade(0, 0, 0, object.timer)
		else
#platform: USE_ORIGINS
			CallNativeFunction2(NotifyCallback, NOTIFY_LEVEL_SELECT_MENU, true)
			CallNativeFunction4(NotifyCallback, NOTIFY_PLAYER_SET, stage.playerListPos, stage.player2Enabled, 0)
#endplatform

			StopMusic()
			temp0 = object.currentSelection
			temp0 *= 6
			temp0 += 2
			GetTableValue(temp1, temp0, MenuControl_EntryTable)
			temp0++
			GetTableValue(temp2, temp0, MenuControl_EntryTable)
			stage.activeList = temp1
			stage.listPos = temp2
			LoadStage()
			SetScreenFade(0x00, 0x00, 0x00, 0xFF)
		end if
		break

	case MENUCONTROL_LOADSPECIAL
		if object.timer < 768
			music.volume -= 10
			object.timer += 8
			SetScreenFade(0xD0, 0xFF, 0xE0, object.timer)
		else
			StopMusic()
			temp0 = object.currentSelection
			temp0 *= 6
			temp0 += 2
			GetTableValue(temp1, temp0, MenuControl_EntryTable)
			temp0++
			GetTableValue(temp2, temp0, MenuControl_EntryTable)
			stage.activeList = temp1
			stage.listPos = temp2
			LoadStage()
			SetScreenFade(0xD0, 0xFF, 0xE0, 0xFF)
		end if
		break
	end switch
end event


event ObjectDraw
	// Two rows, two menus to be drawn
	
	temp0 = screen.xcenter
	temp0 -= 10
	DrawMenu(MENU_1, temp0, 16)
	
	temp0 = screen.xcenter
	temp0 += 142
	DrawMenu(MENU_2, temp0, 16)
end event


event ObjectStartup
	// Load the sprite sheet
	// No need to setup sprite frames since using the menu system will handle them automatically
	LoadSpriteSheet("LevelSelect/Text.gif")

	// All Menu Control objects should be active
	// -> Note that there should only ever be one of them in a scene, though
	foreach (TypeName[Menu Control], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].priority = PRIORITY_ACTIVE
	next

#platform: USE_STANDALONE
	if stage.actNum < 3
		options.stageSelectFlag = true
	end if
#endplatform

	options.touchControls = false

	SetMusicTrack("Options.ogg", 0, true)

		// Setup menu 1 (left column)
	SetupMenu(MENU_1, 0, 3, 1)

	// Add the entries
	AddMenuEntry(MENU_1, "GREEN HILL@@@@ 0", true)
	AddMenuEntry(MENU_1, "1", false)
	AddMenuEntry(MENU_1, "OCEAN WIND@@@@ 0", true)
	AddMenuEntry(MENU_1, "1", false)
	AddMenuEntry(MENU_1, "WOODS@@@@@@@@@ 0", true)
	AddMenuEntry(MENU_1, "1", false)
	AddMenuEntry(MENU_1, "SAND SHOWER@@@ 0", true)
	AddMenuEntry(MENU_1, "1", false)
	AddMenuEntry(MENU_1, "METROPOLIS@@@@ 0", true)
	AddMenuEntry(MENU_1, "1", false)
	AddMenuEntry(MENU_1, "WARP POINT@@@@ 0", true)
	AddMenuEntry(MENU_1, "TROPICAL PLANT 0", true)
	AddMenuEntry(MENU_1, "1", false)
        AddMenuEntry(MENU_1, "BLUE LAKE@@@@@ 0", true)
	AddMenuEntry(MENU_1, "1", false)
	AddMenuEntry(MENU_1, "HILL TOP@@@@@@ 0", true)
	AddMenuEntry(MENU_1, "1", false)
	AddMenuEntry(MENU_1, "ROCK WORLD@@@@ 0", true)
	AddMenuEntry(MENU_1, "1", false)

	// Setup menu 2 (right column)
	SetupMenu(MENU_2, 0, 3, 1)

	// Add its entries
	AddMenuEntry(MENU_2, "OIL OCEAN@@@@@ 0", true)
	AddMenuEntry(MENU_2, "1", false)
	AddMenuEntry(MENU_2, "DUST HILL@@@@@ 0", true)
	AddMenuEntry(MENU_2, "1", false)
	AddMenuEntry(MENU_2, "DEATH EGG@@@@@ 0", true)
        AddMenuEntry(MENU_2, " ", false)
	AddMenuEntry(MENU_2, "BLUE LAKE@@@@@ 0", true)
	AddMenuEntry(MENU_2, "1", false)
	AddMenuEntry(MENU_2, "HILL TOP@@@@@@ 0", true)
	AddMenuEntry(MENU_2, "1", false)
	AddMenuEntry(MENU_2, "CASINO NIGHT@@ 0", true)
	AddMenuEntry(MENU_2, "1", false)
	AddMenuEntry(MENU_2, "CHEMICAL FACTORY 0", true)
	AddMenuEntry(MENU_2, "1", false)
        AddMenuEntry(MENU_2, "GENOCIDE CITY@ 0", true)
	AddMenuEntry(MENU_2, "1", false)
	AddMenuEntry(MENU_2, "2", false)
	AddMenuEntry(MENU_2, "NEO DEATH EGG@ 0", true)
	AddMenuEntry(MENU_2, "1", false)
	AddMenuEntry(MENU_2, "SPECIAL STAGE@@@", true)
	AddMenuEntry(MENU_2, " ", false)
	AddMenuEntry(MENU_2, " ", false)
	AddMenuEntry(MENU_2, "SOUND TEST@ *@@*", true)

	menu1.selection = 0
	menu2.selection = 0
	
	// Not in the original, but origins compiler swaps the value of SPECIAL_STAGE to 2 (rather than 3 originally)
	temp0 = 999
	temp0 *= 099
	temp0 += 299
	SetTableValue(SPECIAL_STAGE, temp0, MenuControl_EntryTable)
end event


// ========================
// Editor Events
// ========================

event RSDKDraw
	DrawSprite(0)
end event


event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
